package cn.mazexal.examapi.models.enums;

import lombok.Getter;

@Getter
public enum QuestionTypeEnum {

    SINGLE_CHOICE(1, "单选"),
    MULTIPLE_CHOICE(2, "多选"),
    SUBJECTIVE(3, "主观题");

    private Integer code;
    private String desc;

    QuestionTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static QuestionTypeEnum getByCode(Integer code) {
        for (QuestionTypeEnum questionTypeEnum : QuestionTypeEnum.values()) {
            if (questionTypeEnum.getCode().equals(code)) {
                return questionTypeEnum;
            }
        }
        return null;
    }

}
